#!/usr/bin/env python
# -*- coding: utf-8 -*-
from db import db_hot_topic, db_hot_topic_hour, db_hot_topic_user
from db import db_sum_of_day, db_hot_like, db_hot_follow

def get_top_by_date(date, num):
    sql_data2 = (date, num)
    result = db_hot_topic.query_by_date(sql_data2)
    return result

def get_frequence_between_date(topic, date_from, date_to):
    sql_data = (topic, date_from, date_to)
    result = db_hot_topic.query_between_date(sql_data)
    return result

def get_frequence_by_hour(date, topic):
    sql_data = (date, topic)
    result = db_hot_topic_hour.query_by_date(sql_data)
    return result

def get_user_by_topic(date, topic):
    sql_data = (date, topic)
    result = db_hot_topic_user.query_by_date(sql_data)
    return result

def get_user_like():
    result = db_hot_like.query()
    return result

def get_hot_follow():
    result = db_hot_follow.query()
    return result

def list_to_string_by_col(l, col):
    result = '"' + str(l[0][col]) + '"' 
    for i in range(1, len(l)):
        result += ', "' + str(l[i][col]) + '"'
    return result
        
        

def main():
    get_top_by_date('20151001', 10)
     
if __name__ == '__main__':
    main() 
    